<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <!-- MOTW-DISABLED saved from url=(0014)about:internet -->
    <title>How to use a stored procedure to retrieve data from a JDBC data source</title>
    <link rel="StyleSheet" href="css/connecting.css" type="text/css" media="all" />
    <link rel="StyleSheet" href="css/webworks.css" type="text/css" media="all" />
    <link rel="StyleSheet" href="webworks.css" type="text/css" media="all" />
    <script type="text/javascript" language="JavaScript1.2">
      <!--
        var  WebWorksRootPath = "";
      // -->
    </script>
  </head>
  <body>
    <div style="text-align: left;">
      <table cellspacing="0" summary="">
        <tr>
          <td>
            <a href="ds-HowToCreateASQLQueryToRetrieveDataFromJDBCDataSource.html"><img src="images/prev.gif" alt="Previous" border="0" /></a>
          </td>
          <td>
            <a href="con-HowToSpecifyConnectionInformationForMongoDBDataSource.html"><img src="images/next.gif" alt="Next" border="0" /></a>
          </td>
        </tr>
      </table>
    </div>
    <hr align="left" />
    <blockquote>
      <h4 class="N_hth_HowToHelp"><a name="343062">How to use a stored procedure to retrieve data from a JDBC data source</a></h4>
      <p class="b_Body"><a name="343069">This procedure assumes you have already created the JDBC data source that this data set uses.</a></p>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <span class="zAuto_0023Format">1&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="343070">In Data Explorer, right-click Data Sets, then choose New Data Set.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <span class="zAuto_0023Format">2&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="343072">In New Data Set, specify the following information: </a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732283464567pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">1&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="343076">In</a><span style="font-family: &quot;Microsoft Sans Serif&quot;; font-size: 9.0pt"> </span>Data Source Selection, select the JDBC data source to use.</div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732283464567pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">2&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="343079">In Data Set Type, select SQL Stored Procedure Query.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n2_NumList2_outer" style="margin-left: 14.1732283464567pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n2_NumList2_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <span class="zAuto_0023FormatGray">3&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n2_NumList2_inner"><a name="343081">In Data Set Name, type a name for the data set. Choose Next.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_i_Indent1"><a name="343083">Query displays a template for executing a stored procedure.</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <span class="zAuto_0023Format">3&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="343084">In Available Items, navigate to the stored procedure. Select the stored procedure, and drag it to the text area. The stored procedure name appears at the insertion point. Type the arguments if the stored procedure uses parameters. </a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_i_Indent1"><a href="#343094" title="How to use a stored procedure to retrieve data from a JDBC data source" name="343088">Figure&nbsp;2-21</a> shows a stored procedure selected in Available Items. The stored procedure has three parameters. The text area displays the call statement to run the stored procedure.</div>
      <p class="i2_Image2"><a name="343092"><img class="Default" src="images/edit_data_set_stored_procedure.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 2-21 Displaying stored procedures in a database" /></a></p>
      <div class="fc2_FigCall2Title">
        <b class="Bold">Figure&nbsp;2-21&nbsp;&nbsp;</b><a name="343094">Displaying stored procedures in a database</a></div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <span class="zAuto_0023Format">4&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="343096">Choose Finish to save the data set.</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="N_n1_NumList1_outer" style="margin-left: 0pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="N_n1_NumList1_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <span class="zAuto_0023Format">5&nbsp;&nbsp;</span>
              </div>
            </td>
            <td width="100%">
              <div class="N_n1_NumList1_inner"><a name="343097">Verify the results returned by the stored procedure, using one of the following steps:</a></div>
            </td>
          </tr>
        </table>
      </div>
      <div class="b2_Bullet2_outer" style="margin-left: 14.1732283464567pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="b2_Bullet2_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <img src="Bullet.png" alt="*" border="0" width="6" height="6" />
              </div>
            </td>
            <td width="100%">
              <div class="b2_Bullet2_inner"><a name="343098">If the stored procedure returns a result set, choose Preview Results to see the data rows. If a stored procedure returns multiple result sets, select the result set you want by specifying the result set’s name or number. To do so, choose Settings and, in Result Set Selection, specify the result set. </a><a href="#343109" title="How to use a stored procedure to retrieve data from a JDBC data source">Figure&nbsp;2-22</a> shows an example of selecting the second result set.</div>
            </td>
          </tr>
        </table>
      </div>
      <p class="i3_Image3"><a name="343107"><img class="Default" src="images/select_resultset.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 2-22 Selecting a result set" /></a></p>
      <div class="fc3_FigCall3Title">
        <b class="Bold">Figure&nbsp;2-22&nbsp;&nbsp;</b><a name="343109">Selecting a result set</a></div>
      <div class="b2_Bullet2_outer" style="margin-left: 14.1732283464567pt">
        <table border="0" cellspacing="0" cellpadding="0" summary="" role="presentation">
          <tr style="vertical-align: baseline">
            <td>
              <div class="b2_Bullet2_inner" style="width: 14.1732283464567pt; white-space: nowrap">
                <img src="Bullet.png" alt="*" border="0" width="6" height="6" />
              </div>
            </td>
            <td width="100%">
              <div class="b2_Bullet2_inner"><a name="343114">If the stored procedure returns output parameter values, choose Preview Output Parameters. </a><a href="#343127" title="How to use a stored procedure to retrieve data from a JDBC data source">Figure&nbsp;2-23</a> shows an example of the values returned by the stored procedure shown in <a href="#343094" title="How to use a stored procedure to retrieve data from a JDBC data source">Figure&nbsp;2-21</a>.</div>
            </td>
          </tr>
        </table>
      </div>
      <p class="i3_Image3"><a name="343125"><img class="Default" src="images/edit_data_set_previewOutParams.png" style="display: inline; float: none; left: 0.0; top: 0.0" alt="Figure 2-23 Previewing output parameter values" /></a></p>
      <div class="fc3_FigCall3Title">
        <b class="Bold">Figure&nbsp;2-23&nbsp;&nbsp;</b><a name="343127">Previewing output parameter values</a></div>
    </blockquote>
    <hr align="left" />
    <table align="right" summary="">
      <tr>
        <td class="WebWorks_Company_Name_Bottom">
          <a href="notices.html">(c) Copyright Actuate Corporation 2013</a>
        </td>
      </tr>
    </table>
  </body>
</html>